<?php
/* ************************************************** *\
 * @company		: NovaITech							  *	
 * @author		: van.vo@novaitech.com				  * 
 * @copyright	: 2012								  * 
 * ================================================== *
 * @date		: 03/26/2012
 * @project		: CodeGenerater
 * @description	:
 *		- Layout entry field.
 *
\* ************************************************** */
class layout extends MY_Controller{
    function __construct(){
        parent::__construct();
    }
    
    function index(){
        if($this->input->post('generator')){
            $table_current = $this->input->post('table'); // Current table
            // -------------------------------------------
            // BEGIN: Get data from XML
            $detail_view    =   $this->xml_model->get_detailview( $table_current, 'detailview');
            $fields         =   $this->xml_model->get_fields( $table_current, 'fields');
            $primarykey     =   $this->xml_model->get_header_infor( $table_current, 'primarykey');
            $table          =   $this->xml_model->get_header_infor( $table_current, 'table');
            // END: Get data from XML
            // -------------------------------------------
            $data['detail_view'] = $detail_view;
            $data['fields']      = $fields;
            $data['primarykey']  = $primarykey;
            $data['layout_name'] = $this->xml_model->duplicate_xml( $table );
            $data['table'] =  $table;
            $this->load->view( 'design/layout_view', $data );
        }
    }
    
    function change_order( $table_name, $move_from, $move_to, $offset = 0 ){
        $this->xml_model->change_order( $table_name, $move_from, $move_to, $offset );
    }
}

?>